package com.fit.components;

import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;
import org.apache.tapestry5.BindingConstants;
import org.got5.tapestry5.jquery.ImportJQueryUI;

import com.fit.services.Authenticator;

/**
 * Layout component for pages of application Nedjeljko.
 */


@Import(stylesheet = {
		"context:layout/css/datePicker.css",
		"context:layout/css/pro_dropline_ie.css",
		"context:layout/css/pro_dropline.css",
		"context:layout/css/screen.css",
		"context:layout/layout.css"
		}, library = {
//		"context:layout/js/Copy of custom_jquery.js",
//		"context:layout/js/custom_jquery.js",
//		"context:layout/js/date.js",
//		"context:layout/js/jquery-1.4.1.min.js",
//		"context:layout/js/jquery.bind.js",
//		"context:layout/js/jquery.datePicker.js",
//		"context:layout/js/jquery.dimensions.js",
//		"context:layout/js/jquery.filestyle.js",
//		"context:layout/js/jquery.pngFix.pack.js",
//		"context:layout/js/jquery.selectbox-0.5_style_2.js",
//		"context:layout/js/jquery.selectbox-0.5_style_3.js",
//		"context:layout/js/jquery.selectbox-0.5.js",
//		"context:layout/js/jquery.tooltip.js",
//		"context:layout/js/jquery.usermode.js",
//		"context:layout/js/ui.checkbox.js",
//		"context:layout/js/ui.core.js",
//		"context:layout/js/filterTable.js",
//		"context:layout/js/actb.js",
//		"context:layout/js/palette.js",
//		"context:layout/js/tablefilter.js"
		})
public class Layout {
	/** The page title, for the <title> element and the <h1>element. */
	@Property
	@Parameter(required = false, defaultPrefix = BindingConstants.LITERAL)
	private String title;

	@Property
	private String pageName;

	@Property
	@Parameter(defaultPrefix = BindingConstants.LITERAL)
	private String sidebarTitle;

	@Property
	@Parameter(defaultPrefix = BindingConstants.LITERAL)
	private Block sidebar;

	@Inject
	private ComponentResources resources;
	@Inject
	private Authenticator authenticator;

	public String getClassForPageName() {
		return resources.getPageName().equalsIgnoreCase(pageName) ? "current_page_item"
				: null;
	}

	public String[] getPageNames() {
//		if (authenticator.isLoggedIn()) {
//			if (authenticator.getLoggedUser().isProfessor()) {
//				return new String [] {"Index", "Language", "Homework", "Professor"};
//			}else {
//				if (authenticator.getLoggedUser().isAdmin()) {
//					return new String [] {"Index", "About","Language", "Homework", "Professor"};
//				}
//			}if (authenticator.getLoggedUser().isStudent()) {
//				return new String [] {"Index", "Contact"};
//
//			}
//		}
//		return new String[] { "Index"};
		return null;
		
	}
}
